package org.jspar.temp;

import org.jspar.model.Module;
import org.jspar.tile.ITileContent;
import org.jspar.tile.Tile;

public class TileInfo implements ITileContent {

	private Module module;
	private Tile tile;
	boolean isHorizontal;

	public TileInfo(Module m, boolean b) {
		this.module = m;
		this.isHorizontal = b;
	}

	public TileInfo(Tile tile, boolean b) {
		this.tile = tile;
		this.isHorizontal = b;
	}

	public boolean testContact(TileInfo i) {
		if (i.isHorizontal == isHorizontal) {
			return i.tile.areaEnumerate(new FreeToRoute(), tile.x(), tile.y(), tile.width(), tile.height()).contains(i.tile);
		}
		return i.tile.areaEnumerate(new FreeToRoute(), tile.x(), tile.y(), tile.width(), tile.height()).contains(i.tile);
	}

	public Module getModule() {
		return module;
	}

	public int congestionCost() {
		return 0;
	}

}
